package com.zxl.admin.controller.api;

import com.zxl.admin.annotation.NoPower;
import com.zxl.admin.context.UserContext;
import com.zxl.admin.service.ApiService;
import com.zxl.common.Result;
import com.zxl.common.model.pojo.SysApi;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zxw
 * @date 2023/4/7
 */
@Api(tags = "接口管理")
@RestController
@RequestMapping("/admin/api")
public class ApiController {

    @Resource
    private ApiService apiService;


    @GetMapping("/getApi")
    @ApiOperation("获取登录权限菜单")
    @NoPower
    public Result<List<SysApi>> getMenu(){
        List<SysApi> menu = apiService.getMenu(UserContext.getUserId());
        return new Result<>(menu);
    }

}
